<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "j_cust_master".
 *
 * @property string $id
 * @property string $username
 * @property string $mobile
 * @property string $pwd
 * @property string $member_no
 * @property string $wx_openid
 * @property string $wx_scan_openid
 * @property string $wx_unionid
 * @property string $wx_nickname
 * @property integer $wx_sex
 * @property string $x_province
 * @property string $wx_city
 * @property string $wx_country
 * @property string $wx_headimgurl
 * @property string $wx_privilege
 * @property string $memo
 * @property integer $use_flg
 * @property string $email
 * @property string $creator
 * @property string $create_time
 * @property string $edit_time
 * @property integer $sex
 * @property integer $member_source
 * @property string $consum_amount
 * @property integer $current_points
 * @property string $birthday
 * @property string $province_code
 * @property string $province_name
 * @property string $city_code
 * @property string $city_name
 * @property string $district_code
 * @property string $district_name
 * @property string $adddress
 * @property integer $source
 * @property string $editor
 */
class CustMaster extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'j_cust_master';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['mobile', 'wx_sex', 'use_flg', 'sex', 'member_source', 'current_points', 'source'], 'integer'],
            [['pwd', 'wx_unionid', 'memo', 'creator', 'editor'], 'required'],
            [['create_time', 'edit_time', 'birthday'], 'safe'],
            [['consum_amount'], 'number'],
            [['username', 'member_no', 'x_province', 'wx_city', 'wx_country', 'email', 'province_code', 'city_code', 'district_code'], 'string', 'max' => 50],
            [['pwd', 'wx_openid', 'wx_scan_openid', 'wx_unionid', 'wx_nickname', 'wx_privilege'], 'string', 'max' => 100],
            [['wx_headimgurl', 'adddress'], 'string', 'max' => 300],
            [['memo'], 'string', 'max' => 1000],
            [['creator', 'editor'], 'string', 'max' => 60],
            [['province_name', 'city_name', 'district_name'], 'string', 'max' => 255],
            [['mobile'], 'unique'],
            [['mobile', 'wx_openid'], 'unique', 'targetAttribute' => ['mobile', 'wx_openid'], 'message' => 'The combination of 手号（登录名） and 微信OPENID has already been taken.'],
            [['member_no'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '自增长',
            'username' => '用户名称',
            'mobile' => '手号（登录名）',
            'pwd' => '密码',
            'member_no' => '会员号',
            'wx_openid' => '微信OPENID',
            'wx_scan_openid' => '微信扫码openid',
            'wx_unionid' => '同一用户，对同一个微信开放平台下的不同应用，unionid是相同的',
            'wx_nickname' => '微信昵称',
            'wx_sex' => '用户的性别，值为1时是男性，0:是未知',
            'x_province' => '用户个人资料填写的省份',
            'wx_city' => '普通用户个人资料填写的城市',
            'wx_country' => '国家，如中国为CN',
            'wx_headimgurl' => '用户头像',
            'wx_privilege' => '用户特权信息，json 数组，如微信沃卡用户为（chinaunicom）',
            'memo' => '备注',
            'use_flg' => '禁用/启用',
            'email' => '邮箱',
            'creator' => '创建人',
            'create_time' => '创建时间',
            'edit_time' => '修改时间',
            'sex' => '线下会员性别1:女;2:男',
            'member_source' => '来源',
            'consum_amount' => '消费金额',
            'current_points' => '积分',
            'birthday' => '会员生日',
            'province_code' => '省CODE',
            'province_name' => '省名称',
            'city_code' => '市CODE',
            'city_name' => '市名称',
            'district_code' => '区CODE',
            'district_name' => '区名称',
            'adddress' => '地址',
            'source' => '1:商城注册；2：线下同步',
            'editor' => '修改人',
        ];
    }
}
